# 导包
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
#  打开浏览器
driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
#定位关键字输入天气预报
kw = driver.find_element(By.ID, "kw")
kw.send_keys('天气预报')
# 全选
time.sleep(3)
kw.send_keys(Keys.CONTROL, "a")
# 复制
kw.send_keys(Keys.CONTROL, "c")

# 请求
driver.get("https://www.so.com")
# 找到搜索框
ipt = driver.find_element(By.ID, "input")
# 粘贴
time.sleep(3)
ipt.send_keys(Keys.CONTROL, "v")
#定位搜素按钮
time.sleep(1)
driver.find_element(By.ID, "search-button").click()
# 关闭浏览器
time.sleep(2)
driver.quit()


